#ifndef _SGE_EDITOR_GUI_H_
#define _SGE_EDITOR_GUI_H_

#include "IEditorComponent.h"
#include <vector>
#include <list>
#include <string>
#include <MapState.h>

namespace irr
{
	namespace gui
	{
		class IGUIElement;
		class IGUIToolBar;
		class IGUIEnvironment;
	}
}

namespace SGF 
{
	namespace mapformat
	{
		class Entity;
	}
}

class IEditorTool;
class TwBar;

class EditorGUI:public IEditorComponent,public SGF::IEntityIterator
{
public:
	EditorGUI(Editor* editor);
	virtual ~EditorGUI();

	void init();
	void render();
	void onPreEdit();
	void onPostEdit();

	bool iterate(SGF::IEntity* entity);

private:
	static void __stdcall setVarCallback(const void *value, void *clientData);
	static void __stdcall getVarCallback(void *value, void *clientData);
	static void __stdcall createButtonCallback(void* data);
	static void __stdcall setPropertyCallback(const void *value, void *clientData);
	static void __stdcall getPropertyCallback(void *value, void *clientData);

	void addTool(IEditorTool* tool);
	void addEntity(SGF::IEntity* entity);
	void treeViewCallback(const irr::SEvent& ev);
	void newEntitySelected(SGF::IEntity* entity);

	std::vector<IEditorTool*> tools;
	IEditorTool* currentTool;
	irr::gui::IGUIElement* gui;	
	irr::gui::IGUIEnvironment* env;
	irr::gui::IGUIToolBar* toolbar;
	std::list<std::string> productList;
	irr::gui::IGUITreeView* treeView;
	TwBar* propertyBar;
	SGF::mapformat::Entity* entityData;
	SGF::SaveData saveData;
};

#endif